{extend name='admin@main'}

{block name="button"}

{if auth("add")}
<button data-modal='{:url("add")}?ware_house_id={$Think.get.ware_house_id}' data-title="添加采购订单" class='layui-btn layui-btn-sm layui-btn-green'>添加采购订单</button>
{/if}

{/block}

{block name="content"}
<div class="think-box-shadow">
    {include file='wh_purchase/index_search'}
    <table class="layui-table" lay-skin="line">
        {notempty name='list'}
        <thead>
            <tr>
                <th class='text-center nowrap'>标题</th>
                <th class='text-center nowrap'>备注</th>
                <th class='text-center nowrap'>总价</th>
                <th class='text-center nowrap'>商品</th>
                <th class='text-center nowrap'>状态</th>
                <th class='text-left nowrap'>添加时间</th>
                <th class='text-left nowrap'></th>
            </tr>
        </thead>
        {/notempty}
        <tbody>
            {foreach $list as $key=>$vo}
            <tr data-dbclick>
                <td class='text-center nowrap'>{$vo.title|default=''}</td>
                <td class='text-center nowrap'>{$vo.remark|default='-'}</td>
                <td class='text-center nowrap'>{$vo.sum_price|default='-'}</td>
                <td class='text-center nowrap'>
                    <a data-dbclick data-title="商品详情" data-modal='{:url("content")}?content={$vo.content}'>详情</a>
                </td>
                <td class='text-center nowrap'>
                    {eq name='vo.status' value='0'}<span class="color-red">处理中</span>{/eq}
                    {eq name='vo.status' value='1'}<span class="color-green">完成</span>{/eq}
                </td>
                <td class='text-left nowrap'>
                    {$vo.create_at|format_datetime}
                </td>
                <td class='text-left nowrap'>
                    {if $vo.status neq 1}
                        <!-- {if auth("edit")} -->
                        <a data-dbclick class="layui-btn layui-btn-sm" data-title="编辑采购订单信息"
                            data-modal='{:url("edit")}?id={$vo.id}'>编 辑</a>
                        <!-- {/if} -->
                        <!-- {if auth("state")} -->
                        <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('state')}" data-confirm="确定确认入库该采购订单吗？"
                            data-value="id#{$vo.id};status#1" data-csrf="{:systoken('state')}">确认入库</a>
                        <!-- {/if} -->
                        <!-- {if auth("remove")} -->
                        <!-- <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除该采购订单吗？"
                            data-action="{:url('remove')}" data-value="id#{$vo.id}" data-csrf="{:systoken('remove')}">删
                            除</a> -->
                        <!-- {/if} -->
                    {else}
                    
                    {/if}

                   

                </td>
            </tr>
            {/foreach}
        </tbody>
    </table>

    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}

</div>
{/block}